package tma.sdcbatch11.foodordering;

import java.util.ArrayList;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class MyArrayAdapter_cart extends ArrayAdapter<Cart> {
	public MyArrayAdapter_cart(Context context, Cart[] list) {
		super(context, 0, list);
		inflater = LayoutInflater.from(context);
	}

	private LayoutInflater inflater;

	@SuppressLint("InflateParams")
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.listview_cart, null);

		}

		TextView tvQuan = (TextView) convertView.findViewById(R.id.tv_Quan);
		TextView tvDishName = (TextView) convertView
				.findViewById(R.id.tv_DishName);
		TextView tvPrice = (TextView) convertView.findViewById(R.id.tv_Price);

		Cart item = getItem(position);
		tvQuan.setText(item.getQuan());
		tvDishName.setText(item.getDishName());
		tvPrice.setText(item.getPrice());

		return convertView;
	}

}
